//
//  WhoCanSeeVC.m
//  神约
//
//  Created by qlwl on 16/12/16.
//  Copyright © 2016年 qlwl. All rights reserved.
//

#import "WhoCanSeeVC.h"

@interface WhoCanSeeVC ()
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation WhoCanSeeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self getMyNavBarWithNavTitle:@"谁可以看" andRightTitle:@"完成" andRightIma:nil and:^(int tag) {
        if (self.finishSelectSeeType) {
            self.finishSelectSeeType(self.seeType);
        }
        [self.navigationController popViewControllerAnimated:YES];
    }];
    self.tableView.tableHeaderView = [UIView new];
}

#pragma mark TabDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * cellName = @"cell";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellName];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellName];
    }
    if (indexPath.row == self.seeType) {
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    }else{
        cell.accessoryType = UITableViewCellAccessoryNone;
    }
    NSArray * titArray = @[@"公开",@"关注",@"秘密"];
    NSArray * detailTitArray = @[@"所有人可见",@"我关注的人可见",@"仅自己可见"];
    cell.textLabel.text = titArray[indexPath.row];
    cell.detailTextLabel.text = detailTitArray[indexPath.row];
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    self.seeType = indexPath.row;
    [tableView reloadData];
}

@end
